package com.hnkywl.sts.action.sfgl;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.hnkywl.sts.dao.sfgl.SfkglDao;
import com.hnkywl.sts.entity.htgl.Cght;
import com.hnkywl.sts.entity.htgl.Ht;
import com.hnkywl.sts.entity.organ.Nbbm;
import com.hnkywl.sts.entity.organ.Nbgs;
import com.hnkywl.sts.entity.sfgl.Sfk;
import com.hnkywl.sts.entity.sys.Gncz;
import com.hnkywl.sts.entity.sys.Yg;
import com.hnkywl.sts.entity.zjgl.Pj;
import com.hnkywl.sts.service.htgl.HtService;
import com.hnkywl.sts.service.organ.GsjgService;
import com.hnkywl.sts.service.sfgl.SkshService;
import com.hnkywl.sts.service.sys.GnczService;
import com.hnkywl.sts.service.sys.YgService;
import com.hnkywl.sts.service.zjgl.PjglService;
import com.hnkywl.sts.util.POIUtil;
import jxl.Sheet;
import jxl.Workbook;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.Region;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.annotation.Namespace;
import org.hibernate.tool.hbm2x.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: cyh
 * Date: 13-4-19
 * Time: 上午10:40
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/sfgl/sksh")
public class SkshAction extends SimpleActionSupport {
    private SkshService skshService;

    private HtService htService;

    private SfkglDao sfkglDao;

    //收款管理Id
    private Long skshId;
    private String zt;
    //单据号码
    private String bm;
    //申报公司机构名称
    private String sbgs;
    //申报公司机构Id
    private Long sbgsId;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows = 10;
    //收付款实例
    private Sfk sksh;
    //远程ajax验证的值
    private String validateVal;
    //需要远程ajax验证的属性
    private String validateField;

    private Long glKhhId;

    private Long xshtId;

    private File upload;

    private Long skgsId;
    private Long skzggsId;
    private Yg skyg;
    //功能操作
    private List<Gncz> gnczList;
    private GnczService gnczService;

    private String sysDate;

    private String gldwMc;

    private Long gldwId;

    private GsjgService gsjgService;

    private Long cprKhhId;

    private String sfje;

    private Date skshEnd;

    private Date skshStart;

//    private List<Pj> pjList;

    private String shrq;

    private String skr;

    private PjglService pjglService;

    private Date sysdate = new Date();

    private Long hzsfkyt;

    private Double hzje;

    private String sfhz;

    private Integer fplx;

    private Long kxsy;

    private Long cghtId;


    //收款管理的查询分页显示
    @Action("skshList")
    public void ygList() {
        this.renderJson(this.skshService.findAllSksh(kxsy, skshStart, skshEnd, bm, sbgs, sbgsId, gldwMc, zt, skr, page, rows));
    }

    @Action("sksh")
    public String sksh() {
        SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd");
        sysDate = simple.format(new Date());
        gnczList = gnczService.findGnczByJsAndUrl(request.getServletPath());
        return SUCCESS;
    }

    //下拉合同的查询分页
    @Action("htList")
    public void htList() {
        renderJson(this.htService.findAllHt(page, rows));
    }

    @Actions({@Action("sksh_content"), @Action("sksh_detail")})
    public String skshContent() {
        Yg yg = YgService.getCurrentYg();
        Long gsId = YgService.getCurrentYgGsId();
        Long zggsId = YgService.getCurrentYgZgGsId();
        //进入update页面
        if (skshId != null) {
            sksh = skshService.findSkshDetail(skshId);
        } else {
            sksh = new Sfk();
            sksh.setSbr(yg);
            sksh.setSbgs((Nbgs) gsjgService.findGsjgDetail(zggsId));
        }
        return SUCCESS;
    }

    @Action("sksh_cz_content")
    public String skshCzContent() {
        Yg yg = YgService.getCurrentYg();
        Long gsId = YgService.getCurrentYgGsId();
        Long zggsId = YgService.getCurrentYgZgGsId();
        Long zgbmId = yg.getZgjg().getId();
        //进入update页面
        if (skshId != null) {
            sksh = skshService.findSkshDetail(skshId);
        } else {
            // 查询当月的合同中的免息天数和贴息率
            Cght cght = this.skshService.findMxtsTxl();
            sksh = new Sfk();
            sksh.setSbr(yg);
            if (null != cght) {
                sksh.setMxts(cght.getMxts());
                sksh.setTxl(cght.getTxl());
            }
            gsjgService.startGsjg(zggsId);
            sksh.setSbgs((Nbgs) gsjgService.findGsjgDetail(zggsId));
        }
        return SUCCESS;
    }

    @Action("sh_nbhz")
    public String shNbhz() {
        sksh = this.skshService.findSkshDetail(skshId);
        return SUCCESS;
    }


    @Action("findskshByXshtList")
    public void findskshByCghtList() {
        this.renderJson(this.skshService.findskshByXshtList(xshtId, page, rows));
    }

    /**
     * 根据客户Id查出保证金的收款
     */
    @Action("findBzjSkList")
    public void findBzjSkList() {
        Ht ht = this.htService.findHt(cghtId);
        this.renderJson(this.skshService.findBzjSkList(gldwId,fplx, ht.getHtms(), page, rows));
    }

    /**
     * 根据客户Id查出合同货款的收款findBzjSkList
     */
    @Action("findHthkSkList")
    public void findHthkSkList() {
        this.renderJson(this.skshService.findHthkSkList(gldwId, fplx, page, rows));
    }

    /**
     * 方法名:     addSksh
     * 功能描述:      增加收款管理
     * 输入参数:
     * 异常:      <RuntimeException  Exception>
     */
    @Action("add_sksh")
    public void addSksh() {
        try {
            if (sksh.getGldw() == null) {
                renderText("{\"statusCode\":\"300\", \"message\":\"关联单位不可为空\"}");
                return;
            }
            this.skshService.saveSksh(sksh, sfje);
            renderText("{\"statusCode\":\"200\", \"message\":\"添加收款单成功！\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    @Action("cz_sksh")
    public void czSksh() {
        try {
            if (sksh.getGldw() == null) {
                renderText("{\"statusCode\":\"300\", \"message\":\"关联单位不可为空\"}");
                return;
            }
           /* if (sksh.getJfejzh() == null) {
                renderText("{\"statusCode\":\"300\", \"message\":\"二级账户不可为空\"}");
                return;
            }*/
            this.skshService.saveCzSksh(sksh, sfje);
            renderText("{\"statusCode\":\"200\", \"message\":\"添加收款单成功！\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }


    /**
     * 方法名:     updateSksh
     * 功能描述:      修改收款管理
     * 输入参数:
     * 异常:      <RuntimeException  Exception>
     */
    @Action("update_sksh")
    public void updateSksh() {
        try {
            this.skshService.updateSksh(sksh, sfje);
            renderText("{\"statusCode\":\"200\",\"message\":\"修改收款单成功！\"}");
        } catch (RuntimeException e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }

    }

    /**
     * 方法名:     deleteSksh
     * 功能描述:      删除数据库收款管理
     * 输入参数:
     * 异常:      <RuntimeException  Exception>
     */
    @Action("delete_sksh")
    public void deleteSksh() {
        try {
            this.skshService.deleteSksh(skshId);
            renderText("{\"statusCode\":\"200\", \"message\":\"删除收款单成功！\", \"operationType\":\"delete\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    /**
     * 远程ajax验证
     */
    @Action("ajax_validate")
    public void ajaxValidate() {
        if (!skshService.ajaxValidate(skshId, validateField, validateVal))
            renderJson("{\"valid\":true}");
        else
            renderJson("{\"valid\":false}");
    }

    //修改收款管理状态
    @Action("change_status")
    public void changeStatus() {
        try {
            skshService.changeStatus(skshId, zt);
            renderText("{\"statusCode\":\"200\", \"message\":\"收款单已提交！\", \"operationType\":\"delete\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }

    }

    @Action("sksh_tj")
    public void skshTj() {
        try {
            skshService.SkshTj(skshId, zt);
            renderText("收款单已提交!");
        } catch (Exception e) {
            e.printStackTrace();
            renderText(e.getMessage());
        }
    }

    @Action("sksh_th")
    public void skshTh() {
        try {
            skshService.SkshTh(skshId, zt);
            renderText("收款单已退回!");
        } catch (Exception e) {
            e.printStackTrace();
            renderText(e.getMessage());
        }
    }

    @Action("sksh_qxsh")
    public void skshQxsh() {
        try {
            if (this.sfkglDao.qxshyz(skshId)) {
                skshService.SkshQxsh(skshId, zt);
                renderText("收款单已取消审核!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            renderText(e.getMessage());
        }
    }

    @Action("sksh_sh_pj") //银票和商票的付款审核
    public String skshShPj() {
        sksh = this.skshService.findSkshDetail(skshId);
        return SUCCESS;
    }

    @Action("sksh_sh_xyz") //银票和商票的付款审核
    public String skshShXyz() {
        sksh = this.skshService.findSkshDetail(skshId);
        return SUCCESS;
    }

    @Action("sksh_sh") //其它收付类型的付款审核
    public String skshSh() {
        sksh = this.skshService.findSkshDetail(skshId);
        return SUCCESS;
    }

    // 入账
    @Action("check_sksh")
    public void checkSksh() {
        try {
            this.skshService.checkSksh(sksh.getId(), cprKhhId);
            renderText("{\"statusCode\":\"200\", \"message\":\"收款已入账！\", \"operationType\":\"add\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    @Action("nbhz_sh")
    public void nbhzSh() {
        try {
            this.skshService.changeStatus(sksh.getId(), "ysh");
            renderText("{\"statusCode\":\"200\", \"message\":\"收款已完成审核！\", \"operationType\":\"add\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    @Action("check_sksh_pj")
    public void checkSkshPj() {
        try {
            this.skshService.checkSkshPj(sksh.getId(), sksh.getPjList());
            renderText("{\"statusCode\":\"200\", \"message\":\"收款已完成审核！\", \"operationType\":\"add\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    @Action("check_sksh_xyz")
    public void checkSkshXyz() {
        try {
            this.skshService.checkSkshXyz(sksh.getId(), sksh.getXyzList());
            renderText("{\"statusCode\":\"200\", \"message\":\"收款已完成审核！\", \"operationType\":\"add\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    // 款项调整详细页面
    @Action("sksh_kxtz")
    public String sksh_kxtz() {
        sksh = this.skshService.findSkshDetail(skshId);
        return SUCCESS;
    }

    // 保存款项调整页面
    @Action("sksh_kxtz_save")
    public void sksh_kxtz_save() {
        try {
            this.skshService.saveTz(sksh);
            renderText("{\"statusCode\":\"200\", \"message\":\"调整成功！\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    // 款项调整明细页面
    @Action("sksh_kxhz_detail")
    public void sksh_kxhz_detail() {
        Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
        sksh = this.skshService.findSkshDetail(skshId);
        List<Map> skshList = new ArrayList<Map>();
        for (Sfk sfk : sksh.getNbhzSfkList()) {
            Map map = new HashMap();
            map.put("bm", sfk.getBm());
            map.put("glqy", sfk.getGldw().getQc());
            map.put("hzje", sfk.getSfje());
            map.put("hzjeye", sfk.getYe());
            if (sfk.getFplx() == 0) {
                map.put("fplx", "非计划现货");
            } else {
                map.put("fplx", "物流金融");
            }
            map.put("kxsy", sfk.getKxsy().getZ());
            map.put("sbgs", sfk.getSbgs().getQc());
            map.put("sbr", sfk.getSbr().getXm());
            map.put("bz", "在【划转款项】菜单中查询详细信息");
            skshList.add(map);
        }
        String result = "{\"rows\":" + gson.toJson(skshList) + "}";
        this.renderJson(result);
    }

    // 款项划转详细页面
    @Action("sksh_kxhz")
    public String sksh_kxhz() {
        sksh = this.skshService.findSkshDetail(skshId);
        return SUCCESS;
    }

    // 保存款项划转页面
    @Action("sksh_kxhz_save")
    public void sksh_kxhz_save() {
        try {
            String str = dealKhhz(sksh);
            this.skshService.saveHzSksh(sksh, hzsfkyt, hzje, fplx, str);
            renderText("{\"statusCode\":\"200\", \"message\":\"划转成功！\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    /**
     * 处理划转信息
     *
     * @param sksh
     * @return 0:只抛账不审核，1：只审核不抛账，2：既要审核又要抛账 ,3: 不抛账不审核
     */
    private String dealKhhz(Sfk sksh) {
        Long dlyId = 126591L; // 代理费
        Long hkId = 120591L; // 货款
        String isYBzj = "0"; // 原来款项是否保证金
        String isXbzj = "0"; // 划转后是否保证金
        if (!sksh.getKxsy().getId().equals(dlyId) && !sksh.getKxsy().getId().equals(hkId)) {
            isYBzj = "1";
        }
        if (!hzsfkyt.equals(dlyId) && !hzsfkyt.equals(hkId)) {
            isXbzj = "1";
        }
        if (sksh.getFplx() == 0 || (sksh.getFplx() == 1 && fplx == 1)) {

            // 原来是货款，划转后不是货款，需要抛账
            if (sksh.getKxsy().getId().equals(hkId)) {
                if (!hzsfkyt.equals(hkId)) {
                    return "0";
                }
            }

            // 原来不是货款，现在是货款
            if (!sksh.getKxsy().getId().equals(hkId)) {
                if (hzsfkyt.equals(hkId)) {
                    return "0";
                }
            }

            // 原来是代理费，划转后不是代理费，需要抛账
            if (sksh.getKxsy().getId().equals(dlyId)) {
                if (!hzsfkyt.equals(dlyId)) {
                    return "0";
                }
            }

            // 原来不是代理费，现在是代理费
            if (!sksh.getKxsy().getId().equals(dlyId)) {
                if (hzsfkyt.equals(dlyId)) {
                    return "0";
                }
            }
        } else {
            // 原来是货款
            if (sksh.getKxsy().getId().equals(hkId)) {
                if (!hzsfkyt.equals(hkId)) {
                    return "2";
                } else {
                    return "1";
                }
            }

            // 原来是代理费
            if (sksh.getKxsy().getId().equals(dlyId)) {
                if (!hzsfkyt.equals(dlyId)) {
                    return "2";
                } else {
                    return "1";
                }
            }

            // 原来是保证金
            if (isYBzj.equals("1")) {
                if (!isXbzj.equals("1")) {
                    return "2";
                } else {
                    return "1";
                }
            }
        }
        return "3";
    }

    //库存报价导入界面展示
    @Action("sksh_sh_pj_upload")
    public String kcbjUpload() {
        return SUCCESS;
    }

    //收款审核批量审核导入
    @Action("sksh_sh_pj_import")
    public void skshShPjImport() {
        try {
            sksh = this.skshService.findSkshDetail(skshId);
            if (!sksh.getPjlx().getZ().equals("银票") && !sksh.getPjlx().getZ().equals("商票")) {
                renderText("{\"statusCode\":\"300\", \"message\":\"收付款款项类型非银票商票，不可批量入账\"}");
                return;
            }
            SimpleDateFormat dateformat = new SimpleDateFormat("yyyy/MM/dd");
            Workbook book = Workbook.getWorkbook(upload);
            //  获得第一个工作表对象
            Sheet sheet = book.getSheet(0);
            //获取总行数
            int rows = sheet.getRows();
            List<Pj> pjList = new ArrayList<Pj>();
            for (int i = 2; i < rows; i++) { //从第三行开始导入
                Pj p = new Pj();
                if (sheet.getCell(0, i) != null && StringUtils.isNotEmpty(sheet.getCell(0, i).getContents())) {//第一列 出票日期
                    p.setCprq(dateformat.parse(sheet.getCell(0, i).getContents()));
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行出票日期为空\"}");
                    return;
                }
                if (sheet.getCell(1, i) != null && StringUtils.isNotEmpty(sheet.getCell(1, i).getContents())) {//第二列 出票银行
                    p.setYscpyh(sheet.getCell(1, i).getContents());
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行出票银行为空\"}");
                    return;
                }
                if (sheet.getCell(2, i) != null && StringUtils.isNotEmpty(sheet.getCell(2, i).getContents())) {//第三列 出票人
                    p.setCpr(sheet.getCell(2, i).getContents());
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行出票人为空\"}");
                    return;
                }
                if (sheet.getCell(3, i) != null && StringUtils.isNotEmpty(sheet.getCell(3, i).getContents())) {//第四列 收款人
                    p.setSkr(sheet.getCell(3, i).getContents());
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行收款人为空\"}");
                    return;
                }
                if (sheet.getCell(4, i) != null && StringUtils.isNotEmpty(sheet.getCell(4, i).getContents())) {//第五列 票据号码
                    if (!pjglService.checkYspjhm(YgService.getCurrentYgGsId(), sheet.getCell(4, i).getContents())) {//如果票据号码重复
                        renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行票据号码重复\"}");
                        return;
                    } else {
                        p.setPjhm(sheet.getCell(4, i).getContents());
                    }
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行票据号码为空\"}");
                    return;
                }
                if (sheet.getCell(5, i) != null && StringUtils.isNotEmpty(sheet.getCell(5, i).getContents())) {//第六列 票面金额
                    p.setDqje(Double.parseDouble(sheet.getCell(5, i).getContents()));
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行票面总金额为空\"}");
                    return;
                }
                if (sheet.getCell(6, i) != null && StringUtils.isNotEmpty(sheet.getCell(6, i).getContents())) {//第七列 到期日期
                    p.setDqr(dateformat.parse(sheet.getCell(6, i).getContents()));
                } else {
                    renderText("{\"statusCode\":\"300\", \"message\":\"第" + (i + 1) + "行到期日为空\"}");
                    return;
                }
                if (sheet.getCell(7, i) != null && StringUtils.isNotEmpty(sheet.getCell(7, i).getContents())) {//第八列 备注
                    p.setBz(sheet.getCell(7, i).getContents());
                } else {
                    p.setBz("");
                }
                pjList.add(p);
            }
            Double pjrzze = 0.0;//票据入账总额
            for (Pj p : pjList) {
                pjrzze += Double.parseDouble(p.getDqje().toString());
            }
            if ((pjrzze * 100) / 100 != sksh.getSfje()) {
                renderText("{\"statusCode\":\"300\", \"message\":\"票据总金额必须等于收付款总金额\"}");
                return;
            }
            sksh.setPjList(pjList);
            this.skshService.checkSkshPj(sksh.getId(), sksh.getPjList());
            renderText("{\"statusCode\":\"200\", \"message\":\"入账成功！\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    //收款批量入账模版导出
    @Action("sksh_sh_pj_export")
    public String skshShPjExport() {
        //第一步，创建一个webbook，对应一个Excel文件
        HSSFWorkbook wb = new HSSFWorkbook();
        //第二步，在webbook中添加一个sheet,对应Excel文件中的sheet
        HSSFSheet sheet = wb.createSheet("sheet1");
        POIUtil poiUtil = new POIUtil(wb);
        //设置列宽
        sheet.setDefaultRowHeightInPoints(15);
        sheet.setDefaultColumnWidth((short) 12);
        sheet.setColumnWidth((short) 0, (short) (8 * 512));
        sheet.setColumnWidth((short) 1, (short) (8 * 512));
        sheet.setColumnWidth((short) 2, (short) (8 * 512));
        sheet.setColumnWidth((short) 3, (short) (8 * 512));
        sheet.setColumnWidth((short) 4, (short) (8 * 512));
        sheet.setColumnWidth((short) 5, (short) (8 * 512));
        sheet.setColumnWidth((short) 6, (short) (8 * 512));
        sheet.setColumnWidth((short) 7, (short) (8 * 512));
        //第三步，在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short
        HSSFRow row = sheet.createRow((int) 0);
        row.setHeightInPoints(36);
        //第四步，创建单元格，并设置值表头  设置表头居中
        HSSFCellStyle titleStyle = poiUtil.createTitleHSSFCellStyle(wb);
        HSSFCell titleCell = row.createCell((short) 0);
        titleCell.setCellStyle(titleStyle);
        titleCell.setEncoding(HSSFCell.ENCODING_UTF_16);
        titleCell.setCellValue("注：日期格式统一为YYYY-MM-DD 例2013-09-28 总金额不可带有,号为纯数字");
        sheet.addMergedRegion(new Region(0, (short) 0, 0, (short) 7));
        //生成第一行数据...表头
        HSSFCellStyle headerStyle = poiUtil.createHeader3HSSFCellStyle(wb);
        poiUtil.fillRow(sheet, headerStyle, 1, "出票日期", "出票银行", "出票人",
                "收款人", "票据号码", "票面总金额", "到期日期", "备注");

        try {
            response.setContentType("application/x-download");
            String filedisplay = new String(("票据批量入账表.xls").getBytes("gb2312"), "iso8859-1");
            response.addHeader("Content-Disposition", "attachment;filename=" + filedisplay);
            wb.write(response.getOutputStream());
            response.getOutputStream().close();
        } catch (Exception e) {
            e.printStackTrace();
            renderText("位置异常，导出失败" + e.getMessage());
        }
        return null;
    }

    @Action("to_sksh_xgshsj")
    public String bgjhywk_yq() {
        sksh = this.skshService.findSkshDetail(skshId);
        SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd");
        if (sksh.getShrq() != null)
            shrq = simple.format(sksh.getShrq());
        return SUCCESS;
    }

    @Action("sksh_xgshsj")
    public void editCght() {
        try {
            this.skshService.xgshrq(sksh);
            renderText("{\"statusCode\":\"200\", \"message\":\"修改审核时间成功\"}");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage() + "\"}");
        }
    }

    //=============================Getter==Setter============================================


    public Date getSysdate() {
        return sysdate;
    }

    public void setSysdate(Date sysdate) {
        this.sysdate = sysdate;
    }

    public Long getGldwId() {
        return gldwId;
    }

    public void setGldwId(Long gldwId) {
        this.gldwId = gldwId;
    }

    public Long getSkshId() {
        return skshId;
    }

    public void setSkshId(Long skshId) {
        this.skshId = skshId;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public Long getSkgsId() {
        return skgsId;
    }

    public void setSkgsId(Long skgsId) {
        this.skgsId = skgsId;
    }

    public Long getSkzggsId() {
        return skzggsId;
    }

    public void setSkzggsId(Long skzggsId) {
        this.skzggsId = skzggsId;
    }

    public Yg getSkyg() {
        return skyg;
    }

    public void setSkyg(Yg skyg) {
        this.skyg = skyg;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public String getBm() {
        return bm;
    }

    public void setBm(String bm) {
        this.bm = bm;
    }

    public String getSbgs() {
        return sbgs;
    }

    public void setSbgs(String sbgs) {
        this.sbgs = sbgs;
    }

    public Long getSbgsId() {
        return sbgsId;
    }

    public void setSbgsId(Long sbgsId) {
        this.sbgsId = sbgsId;
    }

    public String getValidateVal() {
        return validateVal;
    }

    public void setValidateVal(String validateVal) {
        this.validateVal = validateVal;
    }

    public String getValidateField() {
        return validateField;
    }

    public void setValidateField(String validateField) {
        this.validateField = validateField;
    }

    public Sfk getSksh() {
        return sksh;
    }

    public void setSksh(Sfk sksh) {
        this.sksh = sksh;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public Long getGlKhhId() {
        return glKhhId;
    }

    public void setGlKhhId(Long glKhhId) {
        this.glKhhId = glKhhId;
    }

    public List<Gncz> getGnczList() {
        return gnczList;
    }

    public void setGnczList(List<Gncz> gnczList) {
        this.gnczList = gnczList;
    }

    public Long getXshtId() {
        return xshtId;
    }

    public void setXshtId(Long xshtId) {
        this.xshtId = xshtId;
    }

    public String getSysDate() {
        return sysDate;
    }

    public void setSysDate(String sysDate) {
        this.sysDate = sysDate;
    }

    public String getGldwMc() {
        return gldwMc;
    }

    public void setGldwMc(String gldwMc) {
        this.gldwMc = gldwMc;
    }

    public Long getCprKhhId() {
        return cprKhhId;
    }

    public void setCprKhhId(Long cprKhhId) {
        this.cprKhhId = cprKhhId;
    }

    public String getSfje() {
        return sfje;
    }

    public void setSfje(String sfje) {
        this.sfje = sfje;
    }

    public File getUpload() {
        return upload;
    }

    public void setUpload(File upload) {
        this.upload = upload;
    }

    public Date getSkshEnd() {
        return skshEnd;
    }

    public void setSkshEnd(Date skshEnd) {
        this.skshEnd = skshEnd;
    }

    public Date getSkshStart() {
        return skshStart;
    }

    public void setSkshStart(Date skshStart) {
        this.skshStart = skshStart;
    }

    public String getShrq() {
        return shrq;
    }

    public void setShrq(String shrq) {
        this.shrq = shrq;
    }

    public String getSkr() {
        return skr;
    }

    public void setSkr(String skr) {
        this.skr = skr;
    }

    public Long getHzsfkyt() {
        return hzsfkyt;
    }

    public void setHzsfkyt(Long hzsfkyt) {
        this.hzsfkyt = hzsfkyt;
    }

    public Double getHzje() {
        return hzje;
    }

    public void setHzje(Double hzje) {
        this.hzje = hzje;
    }

    public String getSfhz() {
        return sfhz;
    }

    public void setSfhz(String sfhz) {
        this.sfhz = sfhz;
    }

    public Integer getFplx() {
        return fplx;
    }

    public void setFplx(Integer fplx) {
        this.fplx = fplx;
    }

    public Long getKxsy() {
        return kxsy;
    }

    public void setKxsy(Long kxsy) {
        this.kxsy = kxsy;
    }

    public Long getCghtId() {
        return cghtId;
    }

    public void setCghtId(Long cghtId) {
        this.cghtId = cghtId;
    }

    @Autowired
    public void setSkshService(SkshService skshService) {
        this.skshService = skshService;
    }

    @Autowired
    public void setHtService(HtService htService) {
        this.htService = htService;
    }

    @Autowired
    public void setGnczService(GnczService gnczService) {
        this.gnczService = gnczService;
    }

    @Autowired
    public void setSfkglDao(SfkglDao sfkglDao) {
        this.sfkglDao = sfkglDao;
    }

    @Autowired
    public void setGsjgService(GsjgService gsjgService) {
        this.gsjgService = gsjgService;
    }

    @Autowired
    public void setPjglService(PjglService pjglService) {
        this.pjglService = pjglService;
    }
}